home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Screens / Redimension.s < prev    next >
Encoding:
Text File  |  1998-03-16  |  3.7 KB  |  173 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Test routine for height and width alteration.  Move the mouse to alter the
  3. ;position of the screen's right hand corner.  Hold the LMB and move the
  4. ;mouse around to move the entire screen around your monitor.
  5. ;
  6. ;Press RMB to exit.
  7.  
  8.     INCDIR    "GMSDev:Includes/"
  9.     INCLUDE    "dpkernel/dpkernel.i"
  10.  
  11.     SECTION    "Demo",CODE
  12.  
  13. ;===========================================================================;
  14. ;                             INITIALISE DEMO
  15. ;===========================================================================;
  16.  
  17.     STARTDPK
  18.  
  19. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  20.     lea    PictureTags(pc),a0
  21.     sub.l    a1,a1
  22.     CALL    Init
  23.     tst.l    d0
  24.     beq.s    .Exit
  25.  
  26.     lea    ScreenTags(pc),a0
  27.     move.l    Picture(pc),a1
  28.     move.l    PIC_Bitmap(a1),a2
  29.     move.l    BMP_Data(a2),GMemPtr
  30.     move.l    BMP_Palette(a2),GPalette
  31.     sub.l    a1,a1
  32.     CALL    Init
  33.     tst.l    d0
  34.     beq.s    .Exit
  35.  
  36.     moveq    #ID_JOYDATA,d0    ;Get joydata structure for reading
  37.     CALL    Get    ;user input.
  38.     move.l    d0,JoyData
  39.     beq.s    .Exit
  40.     move.l    d0,a0
  41.     sub.l    a1,a1
  42.     CALL    Init
  43.     tst.l    d0
  44.     beq.s    .Exit
  45.  
  46.     move.l    Screen(pc),a0
  47.     CALL    Display
  48.     tst.l    d0
  49.     bne.s    .Exit
  50.  
  51.     bsr.s    Main
  52.  
  53. .Exit    move.l    DPKBase(pc),a6
  54.     move.l    JoyData(pc),a0
  55.     CALL    Free
  56.     move.l    Picture(pc),a0
  57.     CALL    Free
  58.     move.l    Screen(pc),a0
  59.     CALL    Free
  60.     MOVEM.L    (SP)+,A0-A6/D1-D7
  61.     moveq    #ERR_OK,d0
  62.     rts
  63.  
  64. ;===========================================================================;
  65. ;                                MAIN LOOP
  66. ;===========================================================================;
  67.  
  68. Main:    move.l    DPKBase(pc),a6
  69.     move.l    JoyData(pc),a0
  70.     CALL    Query
  71.  
  72.     move.l    JoyData(pc),a1
  73.     move.l    JD_Buttons(a1),d0
  74.     move.w    JD_XChange(a1),d4
  75.     move.w    JD_YChange(a1),d5
  76.  
  77.     btst    #JB_RMB,d0
  78.     bne.s    Fade_Here
  79.  
  80.     move.l    Screen(pc),a0
  81.     add.w    GS_Width(a0),d4
  82.     add.w    GS_Height(a0),d5
  83.  
  84. .chkty    tst.w    d5
  85.     bge.s    .chkby
  86.     moveq    #$00,d5
  87.  
  88. .chkby    cmp.w    #256,d5
  89.     ble.s    .chklx
  90.     move.w    #256,d5
  91.  
  92. .chklx    tst.w    d4
  93.     bge.s    .chkrx
  94.     moveq    #$00,d4
  95.  
  96. .chkrx    cmp.w    #320,d4
  97.     ble.s    .done
  98.     move.w    #320,d4
  99.  
  100. .done    move.l    SCRBase(pc),a6
  101.     move.l    Screen(pc),a0
  102.     CALL    scrWaitAVBL    ;Always wait for a VBL first.
  103.  
  104.     move.l    Screen(pc),a0
  105.     move.w    d5,d1
  106.     move.w    d4,d0
  107.     CALL    scrSetScrDimensions    ;Reposition the screen now.
  108.     bra.s    Main
  109.  
  110. Fade_Here:
  111.     moveq    #00,d7
  112.     move.l    SCRBase(pc),a6
  113.  
  114. .Fade    move.l    Screen(pc),a0
  115.     CALL    scrWaitAVBL
  116.     move.l    Screen(pc),a0
  117.     moveq    #4,d1    ;d1 = Speed
  118.     moveq    #$000,d2
  119.     moveq    #00,d3    ;d1 = Start at colour zero.
  120.     moveq    #32,d4    ;d2 = Amount of colours (32)
  121.     move.l    GS_Bitmap(a0),a5
  122.     move.l    BMP_Palette(a5),a1    ;a1 = Palette to fade to.
  123.     addq.w    #8,a1
  124.     move.w    d7,d0
  125.     CALL    scrPaletteToColour
  126.     move.w    d0,d7
  127.     bne.s    .Fade
  128.     rts
  129.  
  130. ;===========================================================================;
  131. ;                           CODE-RELATIVE DATA
  132. ;===========================================================================;
  133.  
  134. JoyData:    dc.l  0
  135.  
  136. ScreenTags:    dc.l  TAGS_SCREEN
  137. Screen:        dc.l  0
  138.         dc.l  GSA_MemPtr1
  139. GMemPtr:    dc.l  0
  140.         dc.l  GSA_Width,320
  141.         dc.l  GSA_Height,256
  142.         dc.l    GSA_BitmapTags,0
  143.         dc.l    BMA_Palette
  144. GPalette:    dc.l    0
  145.         dc.l    TAGEND,0
  146.         dc.l  GSA_Attrib,SCR_CENTRE
  147.         dc.l  GSA_ScrMode,SM_LACED
  148.         dc.l  TAGEND
  149.  
  150. PictureTags:    dc.l  TAGS_PICTURE
  151. Picture:    dc.l  0
  152.         dc.l    PCA_BitmapTags,0
  153.         dc.l    BMA_Data
  154. PicData:    dc.l    0
  155.         dc.l    BMA_Width,320
  156.         dc.l    BMA_Height,256
  157.         dc.l    BMA_MemType,MEM_VIDEO
  158.         dc.l    TAGEND,0
  159.         dc.l  PCA_Options,IMG_RESIZE
  160.         dc.l  PCA_Source,.file
  161.         dc.l  TAGEND
  162.  
  163. .file        FILENAME "GMS:demos/data/PIC.Green"
  164.  
  165. ;===========================================================================;
  166.  
  167. ProgName:    dc.b  "Redimension",0
  168. ProgAuthor:    dc.b  "Paul Manias",0
  169. ProgDate:    dc.b  "January 1998",0
  170. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  171. ProgShort:    dc.b  "Screen redimensioning demo.",0
  172.         even
  173.